import request from '@/utils/request'
export function getSalaryList(params) {
  return request({
    url: '/salarys/list',
    params // 查询参数
  })
}

// 获取企业计薪及津贴设置
export function getSalarySettings() {
  return request({
    url: '/salarys/settings'
  })
}

// 保存企业计薪及津贴设置
export function saveSalarySettings(data) {
  return request({
    url: '/salarys/settings',
    method: 'POST',
    data
  })
}

// 获取企业是否设置当月工
export function getSalaryCompanySettings() {
  return request({
    url: '/salarys/company-settings'
  })
}

// 根据年月查询企业用户薪资列表
export function getReportList(params) {
  return request({
    url: `/salarys/reports/${params.yearMonth}`,
    params
  })
}

// 批量-导出工资月份报表
export function exportReportList(params) {
  return request({
    url: `/salarys/historys/${params.yearMonth}/export`,
    responseType: 'blob'
  })
}

// 工资数据归档

export function archiveSalarys(yearMonth) {
  return request({
    url: `/salarys/historys/${yearMonth}/archive`,
    method: 'POST'
  })
}

// 构造新月份工资报表
export function newReport(yearMonth) {
  return request({
    url: `/salarys/reports/${yearMonth}/newReport`,
    method: 'PUT'
  })
}

// 员工定薪
export function salarysInit(data) {
  return request({
    url: `/salarys/init/${data.userId}`,
    method: 'POST',
    data
  })
}

// 根据年月查询企业用户薪资列表
export function getSalarysModify(userId) {
  return request({
    url: `/salarys/modify/${userId}`
  })
}

export function saveSalarysModify(data) {
  return request({
    url: `/salarys/modify/${data.userId}`,
    method: 'POST',
    data
  })
}

